﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace School.Pages.BOOKS
{
    public partial class SRV_Book_StockTacking : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((IQueryable<int>)Session["privilage"] != null)
            {
                var x = (IQueryable<int>)Session["privilage"];

                if (x.Contains(1102) == true)
                {
                    if (!this.Page.IsPostBack)
                    {
                        hshow.Value = "0";
                    }
                }
                else
                    Response.Redirect("../organization/no_privelege.aspx");
            }
            else
                Response.Redirect("../organization/no_privelege.aspx");
        }

        protected void odsStock_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            if (CampusPackage1.CampusId != "0")
                e.InputParameters["campusid"] = int.Parse(CampusPackage1.CampusId);
            else
                e.InputParameters["campusid"] = 0;

            if (CampusPackage1.CertificateId != "0")
                e.InputParameters["cerId"] = int.Parse(CampusPackage1.CertificateId);
            else
                e.InputParameters["cerId"] = 0;

            if (CampusPackage1.StageId != "0")
                e.InputParameters["StageId"] = int.Parse(CampusPackage1.StageId);
            else
                e.InputParameters["StageId"] = 0;

            if (CampusPackage1.GradeId != "0")
                e.InputParameters["GradeId"] = int.Parse(CampusPackage1.GradeId);
            else
                e.InputParameters["GradeId"] = 0;
          
        }

        protected void btnPrint_Click(object sender, EventArgs e)
        {
            if (CampusPackage1.CampusId != "0" && CampusPackage1.CertificateId != "0" && CampusPackage1.StageId != "0"
              && CampusPackage1.GradeId != "0")
            {
                rvStock.LocalReport.Refresh();
                hshow.Value = "1";
            }
        }
    }
}